The present invention relates to a moving picture encoder device and moving picture encoding method for compressing moving picture data on a real time basis, which are applicable to a digital still camera (DSC) having the function of storing moving picture data, e.g., moving picture capturing function, a mobile camera phone having a moving picture capturing function, etc.
The encoding process of moving picture data is generally performed by the units of a plurality of pixel data pieces included in a rectangular region called macroblock, i.e., on a macroblock by macroblock basis. The encoding process is performed on the difference in the pixel data between a macroblock to be processed (target macroblock) and a reference macroblock included in a previous frame in order to increase the data compression rate.
The reference macroblock is obtained through the motion vector detection process. Specifically, the sum of the differences in corresponding pixel data between a target macroblock and each of the macroblocks neighboring the position corresponding to the target macroblock in a previous frame, and a macroblock of the minimum sum is selected as a reference macroblock. As the number of macroblocks to be searched becomes larger, i.e., as the number of search operations increases, the possibility of selecting an appropriate macroblock becomes higher, and accordingly, the amount of encoded image data is suppressed to be small. Thus, a method for adaptively controlling the range of search according to the properties of images, etc., has conventionally been known. As the search range is extended, the amount of arithmetic operations increases. The technique of keeping the amount of arithmetic operations substantially constant while suppressing the decrease in the encoding efficiency by adopting a skip search mode or changing the resolution of the objects to be searched has also been known (e.g., Japanese Unexamined Patent Publication No. 11-55677).
However, it is not always easy to appropriately set the range of search. Therefore, in the above conventional techniques, it is impossible to surely suppress the decrease in the encoding efficiency.
Herein, it is possible to consider searching for a reference macroblock with which the sum of differences of pixel data is equal to or smaller than a predetermined threshold instead of searching for a macroblock with which the sum of differences is minimum within a predetermined search range. In such a case, if the motion of an image is larger than expected, a very long span of time is consumed till an intended reference macroblock is found. As a result, the encoding process is not completed within one frame cycle, and accordingly, a so-called frame dropout occurs.